<template>
	<view class="companyDetail" v-if="is_show">
		<!-- <view class="fxBox" @click.stop="fxU=false" v-if="fxU">
			<view class="fxBoxT">
				<view class="" @click.stop="fxU=true">
					<view class="Fxtext">发送给:</view>
					<view style="display: flex;align-items: center;">
						<view class="fxuser">
							<image :src="img_path + logoUrl" mode="aspectFill"></image>
						</view>
						<view class="Fxtext" style="font-size: 16px;">{{ val[0]}}</view>
					</view>
					<view></view>
					<view></view>
				</view>
				<view class="bottomB">
					<view @click="cancellation">取消</view>
					<view @click="determine">确定</view>
				</view>
			</view>
		</view> -->
		<!-- <view class="DEtailimg" v-if="showImg" @click.stop="showImg=false">
			<view @click.stop="showImg=true">
				<image :src="getImgSrc(img_path +business_license+ shuiyin2)" alt="" srcset="" mode="aspectFit" @click="ClickImage"/>
			</view>
		</view> -->
		<!-- @touchstart="touchStart" @touchend="touchEnd" -->
		
		<!-- <view class="fxBox">
			<image :src="img_path + business_license + shuiy" mode="aspectFill"></image>
		</view> -->
		<view class="companyImg" style="display: flex;">
			<view class="titlImg" @click="fxImg">
				<view class="">
					<image :src="img_path + img" mode=""></image>
					<!-- <image v-if="imageHeight" class="Kuan" :src="img_path + img" mode="aspectFill" @load="onImageLoad">
					</image>
					<image v-else :style="{'height': heightS+'px'}" class="Gao" :src="img_path + img" mode=""
						@load="onImageLoad"></image> -->
				</view>
			</view>
			<view class="SlideDetails" style="display: flex;" v-if="xcxq">
				<image class="zjt" src="https://wx.xtwaixie.com/img/more1fb.png" mode=""></image> 滑动进入相册查看详情
			</view>
			<!-- <view class="leftSliding">
				<image src="https://wx.xtwaixie.com/img/laft.png" mode="widthFix"></image>
				<text>左滑</text>
			</view> -->
			<view class="imgCount" @click="fxImg">
				<img src="https://cdn.xtwaixie.com/uploads/20240705/17201768366687d0c4d224f.png" alt="" srcset="" />
				<view class="">
					{{countImg}}
				</view>
			</view>
			<button class="imgCount fxImg publish" open-type="share" style="background: none;">
				<img src="https://cdn.xtwaixie.com/uploads/20240705/17201768366687d0c4956e1.png" alt="" srcset="" />
			</button>
		</view>
		<view class="companyBox" style="margin-bottom: 0;padding: 30rpx 0 30rpx 30rpx;">
			<view style="display: flex;align-items: start;">
				<image style="margin-right: 10px;" :src="img_path + logoUrl" mode="aspectFill"></image>
				<view class="sanDeng" style="width: 460rpx;margin-right: 10rpx;">
					<view class="companyName">{{ val[0] }}</view>
					<view class="companyParticulars"> 员工数 {{staff}}
					</view>
					<view class="companyParticulars"> 工厂面积 {{ factory_area }}
					</view>
				</view>
			</view>
			<view class="bus_license" @click="ClickImage">
				<image src="@/static/icon/Business_license.png" mode="aspectFill"></image>
			</view>
		</view>
		<view class="companyBox" style="border-top: 1px solid  #F1F1F1;padding: 30rpx 0 30rpx 30rpx">
			<view class="" style="width: 596rpx;margin-right: 10rpx;">
				<view class="companyParticulars" style="font-weight: bold;color: black;">
					{{ province }} · {{city}} |
					{{val[4].replace(new RegExp(`(${province}|${city})`, 'g'), '').trim()  }}{{house_number ? '（'+ house_number +'）' : ''}}
					<!-- {{ province }} · {{val[4] }} -->
				</view>
				<view class="companyParticulars" v-if="distance != undefined && latitude">
					<image @tap="getSetting" style="width: 26rpx;height: 26rpx;margin-top: 4rpx;margin-right: 4rpx;"
						src="../../static/ditubiao.png" mode=""></image> 距您{{ distance }}公里
				</view>
				<view style="display: flex;align-items: center;" class="companyParticulars" v-else>
					<view style="margin-right: 20rpx;">
						<image style="width: 26rpx;height: 26rpx;margin-top: 2rpx;margin-right: 4rpx;"
							src="../../static/ditubiao.png" mode=""></image> 距您直线*公里
					</view>
					<!-- 	<view class="bus_license" @tap="getSetting" >
						<image src="@/static/ditu.png" mode="aspectFill"></image>
					</view> -->
					<!-- <image
						src="https://wx.xtwaixie.com/img/location.png" mode="heightFix" style="height: 26px;"></image>开启定位 -->
				</view>
			</view>
			<view class="bus_license" @tap="getSetting">
				<image src="@/static/ditu.png" mode="aspectFill"></image>
			</view>
		</view>
		<view class="companyIntro">
			<view class="companyComponents">
				<view class=""></view>
				<view class=""> 公司简介 </view>
			</view>
			<view class="companyCompanyIntroduction">
				<text :class="show ? '' :'text-ellipsis'" @tap="show = true">
					{{ companyIntroduction ? companyIntroduction : '该公司暂未填写简介' }}
				</text>
			</view>
			<!-- <view class="companyComponents">
				<view class="">

				</view>
				<view class="">
					擅长工艺
				</view>
			</view>
			<view class="processingTechnology">
				<view class="" v-for="(item,index) in processingTechnology" :key="index">
					{{ item }}
				</view>
			</view> -->
		</view>
		<view class="detailedness">
			<view class="detailednessBox" @tap="openPopup">
				<view class="detailednessTitle">
					<image src="https://wx.xtwaixie.com/img/list1.png" mode="widthFix"></image>
					<view class=""> 设备清单 </view>
				</view>
				<view class="processingTechnology">
					<view class="processingTechnology_list"><!-- 	<view class="processingTechnology_item" v-for="(item,index) in equipmentList" :key="index">
							{{ item.name }}
						</view> -->
						<view class="processingTechnology_item"> {{totalNumber ? totalNumber : 0}}台 </view>
					</view>
					<view class="arrow_right">
						<image style="width: 25rpx;" src="@/static/icon/right_arrow.png" mode="widthFix"></image>
					</view>
				</view>
			</view>
			<view class="detailednessBox">
				<view class="detailednessTitle">
					<image src="https://cdn.xtwaixie.com/uploads/20240705/17201768366687d0c4ed3b1.png" mode="widthFix">
					</image>
					<view class=""> 工艺 </view>
				</view>
				<view class="processingTechnology">
					<view class="processingTechnology_item" v-for="(item,index) in machining" :key="index">
						{{ item }}
					</view>
				</view>
			</view>
			<view class="detailednessBox">
				<view class="detailednessTitle">
					<image src="https://wx.xtwaixie.com/img/list2.png" mode="widthFix"></image>
					<view class=""> 可加工材料 </view>
				</view>
				<view class="processingTechnology">
					<view class="processingTechnology_item" v-for="(item,index) in materials" :key="index">
						{{ item }}
					</view>
				</view>
			</view>
			<view class="detailednessBox">
				<view class="detailednessTitle">
					<image src="https://wx.xtwaixie.com/img/list3.png" mode="widthFix"></image>
					<view class=""> 资质认证 </view>
				</view>
				<view class="processingTechnology">
					<view class="processingTechnology_item" v-for="(item,index) in certificate" :key="index">
						{{ item }}
					</view>
				</view>
			</view>
			<view class="detailednessBox">
				<view class="detailednessTitle">
					<image src="https://cdn.xtwaixie.com/uploads/20240705/17201768366687d0c471566.png" mode="widthFix">
					</image>
					<view class=""> 行业领域 </view>
				</view>
				<view class="processingTechnology">
					<view class="processingTechnology_item" v-for="(item,index) in service_industry_name" :key="index">
						{{ item }}
					</view>
				</view>
			</view>
			<view class="detailednessBox">
				<view class="detailednessTitle">
					<image src="https://cdn.xtwaixie.com/uploads/20240705/17201768366687d0c4b1cf5.png" mode="widthFix">
					</image>
					<view class="">合作客户</view>
				</view>
				<view class="processingTechnology">
					<view class="processingTechnology_item" v-for="(item,index) in clientinfo" :key="index">
						{{ item.name }}
					</view>
				</view>
			</view>
		</view>
		<view class="companyProduct ">
			<view class="companyProductTitle"> 公司产品 </view>
			<view class="companyProductBox" style="border-bottom:1px solid #F1F1F1;">
				<!-- <view class="" v-for="(item,index) in productList" :key="index" @click="look(item)">
					<image :src="img_path + item.url" mode="aspectFill"></image>
					<view class="">
						{{ item.name }}
					</view>
				</view> -->
				<view class="" v-for="(item,index) in productList" :key="index" @click="gscp=true">
					<image :src="img_path + item.url" mode="aspectFill">
					</image>
					<view class="text_con">
						<view class="text_con_title">{{ item.name }}</view>
						<view class="text_desc" style="color: #9C9C9C;">{{ item.machining }}</view>
						<view class="text_desc" style="color: #9C9C9C;">{{ item.material }}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="companyProduct" style="padding-bottom: 40rpx;">
			<view class="companyProductTitle"> 工商信息 </view>
			<view class="">
				<view class="Business-Infor">
					<view>
						<view class="Business-title">公司名称</view>
						<view class="Business-Miao">{{basicName}}</view>
					</view>
					<view>
						<view class="Business-title">注册地址</view>
						<view class="Business-Miao">{{basicAddress}}</view>
					</view>
					<view style="border-bottom: 1px solid gainsboro;">
						<view class="Business-title">法定代表人名称</view>
						<view class="Business-Miao">{{basicOperName}}</view>
					</view>
				</view>
				<view class="Business-view" @click="toggleS"> 查看全部介绍 </view>
			</view>
			<view>
				<van-action-sheet :actions=" actions " :show="showS" title="工商信息" @close="showS = false">
					<view class="" style="margin-top: 48px;height: 900rpx;">
						<view class="BusiN-t">
							<view class="Busi-left"> 公司名称 </view>
							<view class="Busi-right"> {{basicName}} </view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 注册地址 </view>
							<view class="Busi-right"> {{basicAddress}} </view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 法定代表人名称 </view>
							<view class="Busi-right">
								{{basicOperName}}
							</view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 企业类型 </view>
							<view class="Busi-right">
								{{basicEconKind}}
							</view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 成立时间 </view>
							<view class="Busi-right">
								{{basicStartDate?basicStartDate.split(' ')[0]:""}}
							</view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 注册资本 </view>
							<view class="Busi-right">
								{{basicRegistCapi ?basicRegistCapi:"-"}}
							</view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 统一社会信用代码 </view>
							<view class="Busi-right">
								{{basicCreditCode&&basicCreditCode!=null?basicCreditCode:"-"}}
							</view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 登记状态 </view>
							<view class="Busi-right">
								{{basicStatus&&basicStatus!=null?basicStatus.split("（")[0]:"-"}}
							</view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 工商注册号 </view>
							<view class="Busi-right">
								{{No&&No!=null?No:"-"}}
							</view>
						</view>
						<view class="BusiN-t">
							<view class="Busi-left"> 经营范围 </view>
							<view class="Busi-right">
								{{basicScope&&basicScope!=null?basicScope:"-"}}
							</view>
						</view>
						<view class="BusiN-t" style="border-bottom:1px solid gainsboro ;margin-bottom: 60rpx;">
							<view class="Busi-left"> 实缴资本 </view>
							<view class="Busi-right">
								{{basicRecCap && basicRecCap!=null ?basicRecCap:"-"}}
							</view>
						</view>
					</view>
				</van-action-sheet>
			</view>
		</view>
		<view class="product" v-if="gscp">
			<view class="uni-margin-wrap" @click="gscp=false">
				<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay"
					:interval="interval" :duration="duration">
					<swiper-item v-for="(item,index) in productList" :key="index">
						<image :src="img_path + item.url" mode="aspectFill">
						</image>
						<view class="swipertitile">
							<view class="swiper-item productList-N">{{item.name}}</view>
							<view class="gy text_desc">工艺：{{ item.machining }}</view>
							<view class="cl text_desc">材料：{{ item.material }}</view>
						</view>
					</swiper-item>
				</swiper>
			</view>
		</view>
		<!-- <uni-popup ref="popup" type="bottom" background-color="#fff" @change="change">
				<view class="">
					1111
				</view>
		</uni-popup> -->
		<van-popup :show="showPopup" :round="true" @close="closePopup" :close-on-click-overlay="true" position="bottom">
			<view class="popup_con">
				<view class="xPopupTitle"> 设备列表 </view>
				<view class="pci_desc">
					<view class="">名称</view>
					<view class="">型号</view>
					<view class="">品牌</view>
					<view class="">数量</view>
				</view>
				<view class="pc_item" v-for="(item,index) in equipmentList" :key="index">
					<view class="pci_desc">
						<view class="item">{{ item.name }}</view>
						<view class="item">{{ item.model }}</view>
						<view class="item">{{ item.brand }}</view>
						<view class="item">{{ item.number }}</view>
					</view>
				</view>
			</view>
		</van-popup>
	</view>
</template>
<script>
	const http = require('../../utils/http');
	export default {
		data() {
			return {
				xcxq: false,
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 600,
				id: 0,
				gscp: false,
				show: false,
				showPopup: false,
				img: '/uploads/20240612/171816998866693184c42db.jpg',
				img_path: http.img_path,
				logoUrl: '/uploads/20240612/1718170022666931a6207b6.jpg',
				val: ['', '', '', '', ''],
				info: {},
				employeesNumList: [],
				distance: undefined,
				employeesNum: '',
				companyIntroduction: '',
				processingTechnology: [],
				productList: [],
				equipmentList: [],
				materials: [],
				certificate: [],
				latitude: 0,
				longitude: 0,
				startX: 0,
				vwidth: 0,
				business_license: '',
				showImg: false,
				service_industry_name: [],
				machining: [],
				clientinfo: [],
				countImg: '',
				fxU: false,
				imageHeight: false,
				heightS: '',
				basicAddress: '',
				basicName: '',
				basicOperName: '',
				basicEconKind: '',
				basicStartDate: "",
				basicRegistCapi: "",
				basicCreditCode: "",
				basicStatus: "",
				basicRecCap: "",
				basicNo: '',
				basicScope: "",
				basicNo: "",
				showS: false,
				staff: "",
				factory_area: "",
				annual_output_value: "",
				province: "",
				city: "",
				detailedAddress: "",
				house_number: '',
				shuiy: '?watermark/1/image/aHR0cDovL3h0d2FpeGllLTEzMTQ4MDk2MjgucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4yLnBuZw/gravity/southeast/batch/1/degree/315/dissolve/60/scatype/3/spcent/20',
				is_show:false,
			};
		},
		computed: {
			totalNumber() {
				let sum = 0;
				this.equipmentList.forEach(item => {
					sum += parseInt(item.number);
				});
				return sum;
			}
		},
		onLoad(option) {
			setTimeout(()=>{
				this.is_show = true
			},100)
			this.id = option.id
			this.getBase(option.id)
			this.openGps()
			const _this = this
			uni.getSetting({
				success(res) {
					if (!res.authSetting['scope.userLocation']) {
						uni.authorize({
							scope: 'scope.userLocation',
							success() {
								// _this.getLocation()
								uni.reLaunch({
									url: "/pages/companyDetail/companyDetail"
								});
							},
							fail() {
								uni.showModal({
									title: '请求授权当前位置',
									content: '需要获取您的地理位置，请确认授权',
									success(res) {
										if (res.cancel) {
											//用户拒绝授权
											return uni.showToast({
												title: '拒绝授权获取地址信息',
												icon: 'none'
											});
										} else if (res.confirm) {
											uni.openSetting({
												success(res) {
													console.log(res)
													if (res.authSetting[
															'scope.userLocation']) {
														// _this.getLocation()
														uni.reLaunch({
															url: "/pages/companyDetail/companyDetail"
														});
													} else {
														return uni.showToast({
															title: '拒绝授权获取地址信息',
															icon: 'none'
														});
													}
												},
												fail() {
													console.log(111)
													return uni.showToast({
														title: '拒绝授权获取地址信息',
														icon: 'none'
													});
												}
											})
										}
									}
								})
							}
						})
					} else {
						// _this.getLocation()
					}
				}
			})
		},
		onShow() {
			this.xcxq = false;
		},
		methods: {
			ClickImage() {
				uni.previewImage({
					urls: [this.img_path + this.business_license + this.shuiy],
					current: this.img_path + this.business_license + this.shuiy,
					success: function(res) {},
					fail: function(res) {},
					complete: function(res) {},
				})
			},
			onShareAppMessage() {
				let imageUrl = this.img_path + this.img;
				let name = this.val[0]
				console.log(this.id);
				let id = this.id
				return {
					title: name,
					path: `/pages/companyDetail/companyDetail?id=${id}`,
					imageUrl: imageUrl,
				};
			},
			toggleS() {
				this.showS = true
			},
			previewImg(url, index) {
				console.log(url)
				const urls = this.productList.map(item => this.img_path + item.url)
				console.log(urls)
				// uni.previewImage({
				// 	current: index,
				// 	urls: urls,
				// })
			},
			openGps() {
				let system = uni.getSystemInfoSync(); // 获取系统信息
				if (system.platform === 'android') { // 判断平台
					var context = plus.android.importClass("android.content.Context");
					var locationManager = plus.android.importClass("android.location.LocationManager");
					var main = plus.android.runtimeMainActivity();
					var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
					if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
						uni.showModal({
							title: '提示',
							content: '请打开定位服务功能',
							showCancel: false, // 不显示取消按钮
							success() {
								var Intent = plus.android.importClass('android.content.Intent');
								var Settings = plus.android.importClass('android.provider.Settings');
								var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
								main.startActivity(intent); // 打开系统设置GPS服务页面
							}
						});
					}
				} else if (system.platform === 'ios') {
					var cllocationManger = plus.ios.import("CLLocationManager");
					var enable = cllocationManger.locationServicesEnabled();
					var status = cllocationManger.authorizationStatus();
					plus.ios.deleteObject(cllocationManger);
					console.log("手机系统的定位没有打开");
					uni.showModal({
						title: '提示',
						content: '请打开定位服务功能',
						showCancel: false, // 不显示取消按钮
						success() {
							var UIApplication = plus.ios.import("UIApplication");
							var application2 = UIApplication.sharedApplication();
							var NSURL2 = plus.ios.import("NSURL");
							var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION");
							application2.openURL(setting2);
							plus.ios.deleteObject(setting2);
							plus.ios.deleteObject(NSURL2);
							plus.ios.deleteObject(application2);
						}
					});
				}
			},
			openPopup() {
				this.showPopup = true;
			},
			closePopup() {
				this.showPopup = false;
			},
			touchStart(e) {
				if (e.touches.length == 1) {
					this.startX = e.touches[0].clientX;
				}
			},
			businessLimg() {
				console.log(1);
			},
			handleClickS() {
				// this.fxU = true;
				// this.xcxq = false;
				// var weixinShare = null;
				// plus.share.getServices(function(services) {
				// 	for (var i in services) {
				// 		var service = services[i];
				// 		// 获取微信分享对象
				// 		if (service.id == 'weixin') {
				// 			weixinShare = service;
				// 			break;
				// 		}
				// 	}
				// 	weixinShare.send( {
				// 		content: '我正在使用HBuilderX开发App，赶紧跟我一起来体验！'
				// 	}, function(){
				// 		// 分享成功
				// 	}, function(err) {
				//     // 分享操作失败
				//     // err.code是错误码
				// 	})
				// }, function(err) {
				// 	// 获取 services 失败
				// })
				// clg
				// uni.share({
				//     provider: 'weixin',
				//     scene: "WXSceneSession",
				//     type: 5,
				//     imageUrl: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/share-logo@3.png',
				//     title: '欢迎体验uniapp',
				//     miniProgram: {
				//         id: 'gh_abcdefg',
				//         path: 'pages/index/index',
				//         type: 0,
				//         webUrl: 'http://uniapp.dcloud.io'
				//     },
				//     success: ret => {
				//         console.log(JSON.stringify(ret));
				//     }
				// });
				uni.share({
					provider: "weixin",
					scene: "WXSceneSession",
					type: 1,
					summary: "我正在使用HBuilderX开发uni-app，赶紧跟我一起来体验！",
					success: function(res) {
						console.log("success:" + JSON.stringify(res));
					},
					fail: function(err) {
						console.log("fail:" + JSON.stringify(err));
					}
				});
				console.log(1);
			},
			fxfriend() {},
			fxImg() {
				uni.navigateTo({
					url: '/subPack/companyAlbum/companyAlbum?id=' + this.id
				})
			},
			cancellation() {
				this.fxU = false
			},
			determine() {
				this.fxU = false
			},
			touchEnd(e) {
				this.xcxq = true
				setTimeout(() => {
					if (e.changedTouches.length == 1) {
						var endX = e.changedTouches[0].clientX;
						let diff = endX - this.startX;
						if (Math.abs(diff) > 30) {
							if (diff > 0) {
								this.vwidth += 60;
							} else {
								uni.navigateTo({
									url: '/subPack/companyAlbum/companyAlbum?id=' + this.id
								})
								this.vwidth -= 60;
								if (this.vwidth < 0) {
									this.vwidth = 0;
								}
							}
						}
					}
				}, 200)
			},
			look(item) {
				uni.previewImage({
					urls: [this.img_path + item.url]
				})
			},
			getBase(id) {
				http.request('user/configData').then((res) => {
					this.setData({
						bese_info: res.data
					});
					const {
						order_type,
						account_period_range,
						staff,
						annual_output_value,
						factory_area,
						material,
						qualification
					} = res.data
					// this.typeList = order_type
					// this.periodList = account_period_range
					this.employeesNumList = staff
					// this.yearNumList = annual_output_value
					// this.areaNumList = factory_area
					// this.materialList = material
					// this.qualification = qualification
					this.getInfo(id)
				}).catch((res) => {
					uni.showToast({
						title: res.message,
						icon: 'none'
					});
				});
			},
			getDistances(lat1, lng1) {
				let EARTH_RADIUS = 6378.137; // 地球半径
				let radLat1 = lat1 * Math.PI / 180.0; //lat1 * Math.PI / 180.0=>弧度计算
				let radLat2 = this.latitude * Math.PI / 180.0;
				let a = radLat1 - radLat2;
				let b = lng1 * Math.PI / 180.0 - this.longitude * Math.PI / 180.0;
				let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math
					.pow(Math.sin(b / 2), 2)));
				s = s * EARTH_RADIUS;
				s = Math.round(s * 10000) / 10000; // 输出为公里
				return {
					m: s * 1000,
					km: Number(s.toFixed(2))
				}
			},
			getSetting() {
				const _this = this
				uni.getSetting({
					success(res) {
						if (!res.authSetting['scope.userLocation']) {
							uni.authorize({
								scope: 'scope.userLocation',
								success() {
									_this.getLocation()
								},
								fail() {
									uni.showModal({
										title: '请求授权当前位置',
										content: '需要获取您的地理位置，请确认授权',
										success(res) {
											if (res.cancel) {
												//用户拒绝授权
												return uni.showToast({
													title: '拒绝授权获取地址信息',
													icon: 'none'
												});
											} else if (res.confirm) {
												uni.openSetting({
													success(res) {
														console.log(res)
														if (res.authSetting[
																'scope.userLocation']) {
															_this.getLocation()
														} else {
															return uni.showToast({
																title: '拒绝授权获取地址信息',
																icon: 'none'
															});
														}
													},
													fail() {
														console.log(111)
														return uni.showToast({
															title: '拒绝授权获取地址信息',
															icon: 'none'
														});
													}
												})
											}
										}
									})
								}
							})
						} else {
							_this.getLocation()
						}
					}
				})
			},
			getLocation() {
				let that = this;
				if (that.distance === undefined) {
					uni.getLocation({
						type: 'gcj02',
						success(res) {
							console.log(res);
							that.distance = that.getDistances(res.latitude, res.longitude).km
							if (that.latitude) {
								console.log(that.latitude);
								uni.openLocation({
									latitude: parseFloat(that.latitude),
									longitude: parseFloat(that.longitude),
									name: that.val[0], // 可以指定标记名称
									address: that.val[4],
									scale: 18
								})
							}
						},
						fail(err) {
							console.log(err);
						}
					});
				} else if (that.latitude) {
					uni.openLocation({
						latitude: parseFloat(that.latitude),
						longitude: parseFloat(that.longitude),
						name: that.val[0], // 可以指定标记名称  
						address: that.val[4],
						scale: 18,
						success: function() {
							console.log('success');
						},
						fail(err) {
							console.log(err);
						}
					})
				}
			},
			getInfo(id) {
				http.request('user/settledInfo', {
					id
				}).then((res) => {
					// console.log(res.data.info);
					// console.log(res.data.info.basic);
					// console.log(res);
					let data = res.data.info
					let status = !!data.detail
					let jsonObject = JSON.parse(data.basic)
					// console.log(data.introduction,'data.introduction')
					console.log(status)
					if (status) {
						data = {
							...data,
							...data.detail
						}
						
						if(jsonObject){
							this.basicName = jsonObject.Name
							this.basicResult = jsonObject.Result
							this.basicAddress = jsonObject.Address
							this.basicOperName = jsonObject.OperName
							this.basicEconKind = jsonObject.EconKind
							this.basicStartDate = jsonObject.StartDate
							this.basicRegistCapi = jsonObject.RegistCapi
							this.basicCreditCode = jsonObject.CreditCode
							this.basicStatus = jsonObject.Status
							this.basicRecCap = jsonObject.RecCap
							this.basicScope = jsonObject.Scope
							this.basicNo = jsonObject.basicNo
						}
					}
					
					// console.log(data.introduction,'data.introduction')
					if (data.logo) {
						this.logoUrl = data.logo
					}
					let staff = this.employeesNumList.filter(item => item.value == data.staff)
					this.employeesNum = staff.length == 0 ? '' : staff[0].text
					if (data.doorboard) {
						this.img = data.doorboard
					} else if (data.logo) {
						this.img = data.logo
					} else if (data.company_environment && data.company_environment.length > 0) {
						this.img = data.company_environment[0]
					} else if (data.equipment_img && data.equipment_img.length > 0) {
						this.img = data.equipment_img[0]
					}
					// console.log(data.introduction,'data.introduction')
					this.companyIntroduction = data.introduction
					this.processingTechnology = data.machining
					this.business_license = data.business_license
					this.productList = data.main_products || []
					this.equipmentList = data.equipment || []
					this.materials = data.infoName.processing_materials
					this.service_industry_name = data.infoName.service_industry_name
					this.certificate = data.infoName.qualification
					this.latitude = data.latitude
					this.longitude = data.longitude
					this.machining = data.machining
					this.clientinfo = data.clientinfo
					this.countImg = data.images_count
					this.factory_area = data.infoName.factory_area
					this.annual_output_value = data.infoName.annual_output_value
					this.staff = data.infoName.staff
					this.province = data.province
					this.city = data.city
					this.house_number = data.house_number
					// this.machiningList = data.machining_id
					// this.typeChecked = data.order_type
					// this.orderType = data.infoName.order_type.join('、')
					// this.yearNum = this.yearNumList.map(item=>item.value).indexOf(data.annual_output_value)
					// this.areaNum = this.areaNumList.map(item=>item.value).indexOf(data.factory_area)
					// this.periodChecked = data.account_period_range
					// this.accountingPeriod = data.infoName.account_period_range.join('、')
					// this.exportRights = data.import_export_power
					// this.certificateChecked = data.qualification_id
					// this.serviceIndustry = data.service_industry
					if (data.latitude) {
						let that = this
						that.distance = undefined
						uni.getLocation({
							type: 'gcj02',
							success: (res) => {
								that.distance = that.getDistances(res.latitude, res.longitude).km
							}
						})
					}
					if (data.company) {
						// if (data.status == 1 || data.status == 3) {
						// 	this.info_show = true
						// } else {
						// 	this.info_show = false
						// }
						this.setData({
							[`val[0]`]: data.company,
							[`val[1]`]: data.business_license,
							[`val[2]`]: data.person,
							[`val[3]`]: data.mobile,
							[`val[4]`]: data.address,
							['area[0]']: data.province,
							['area[1]']: data.city,
						});
					}
					this.setData({
						info: data
					});
					const nameList = []
					this.productList.forEach((item, index) => {
						nameList = []
						this.materialList.forEach((v, i) => {
							if (item.material_id.includes(v.id)) {
								nameList.push(v.name)
							}
						})
						this.productList[index].material = nameList.join("、")
						nameList = []
						this.bese_info.machining.forEach((res, i) => {
							res.children.forEach(v => {
								if (item.machining_id.includes(v.id)) {
									nameList.push(v.name)
								}
							})
						})
						this.productList[index].machining = nameList.join("、")
					})
				}).catch((res) => {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					});
				});
			},
		},
	}
</script>
<style lang="scss">
	.van-action-sheet__header {
		position: fixed;
		width: 100%;
		background: white;
		border-radius: 30rpx 30rpx 0 0;
		// top: -48px;
	}

	.sanDeng {
		display: flex;
		flex-direction: column;
		flex-wrap: wrap;
	}

	.BusiN-t {
		display: flex;
		text-align: center;
		font-size: 13px;
		line-height: 30px;
		width: 100%;
		border-top: 1px solid gainsboro;

		.Busi-left {
			background-color: #cef6fc;
			width: 34%;
			border-right: 1px solid gainsboro;
		}

		.Busi-right {
			width: 64%;
			padding: 0 1%;
		}
	}

	.Business-Infor {
		font-size: 12px;
		text-align: center;

		>view {
			display: flex;
			line-height: 30px;
			border-top: 1px solid gainsboro;
		}

		.Business-Miao {
			width: 68%;
			padding: 0 1%;
			border-left: 1px solid gainsboro;
			border-right: 1px solid gainsboro;
		}

		.Business-title {
			width: 30%;
			border-left: 1px solid gainsboro;
		}
	}

	.Business-view {
		text-align: center;
		padding: 10px 10px;
		font-size: 12px;
		color: #1050c7;
		margin-bottom: 40rpx;
	}

	.Dingw {
		// margin: 0rpx 0rpx 0rpx 130rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		font-size: 22rpx;
		width: 140rpx;
		height: 50rpx;
		background: url('https://wx.xtwaixie.com/img/radius_blue.png');
		// 'https://wx.xtwaixie.com/img/radius_blue.png'
		background-size: 100%;
		background-position: center;
	}

	.titlImg {
		width: 100%;
		height: auto;
		margin: 0 auto;

		image {
			width: 100%;
		}
	}

	.album_list {
		margin-top: 20rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;

		.al_item {
			width: 48%;
			height: 220rpx;
			border: 2rpx solid rgba(0, 0, 0, 0.05);
			margin-bottom: 20rpx;

			// background-color: #468CB2;
			image {
				width: 100%;
				height: 100%;
			}
		}
	}

	.Gao {
		margin: 0% 0 0 10%;
		width: 80% !important;
	}

	.Kuan {
		margin: 10% 0%;
	}

	.swipertitile {
		position: absolute;
		bottom: 0%;
	}

	.zjt {
		position: absolute;
		top: 48%;
		width: 15px;
		height: 15px;
		right: 20%;
	}

	.SlideDetails {
		width: 20px;
		padding: 100px 50px 0;
		background: white;
	}

	.uni-margin-wrap {
		padding: 20% 0 20% 0;
		height: 80%;

		.swiper {
			height: 100%;

			.productList-N {
				background-color: gray;
				padding: 4px 8px;
				border-radius: 8px 8px;
				margin-left: 10px;
				text-align: center;
				display: inline;
			}

			.gy {
				margin-left: 10px;
				line-height: 40px;
			}

			.cl {
				margin-left: 10px;
			}
		}

		image {
			width: 100%;
			height: 80%;
			object-fit: cover;
		}

		view {
			color: white;
		}
	}

	.fxBox {
		width: 100%;
		height: 100vh;
		background-color: rgba(0, 0, 0, 0.3);
		position: fixed;
		top: 0;
		z-index: 111;

		.fxBoxT {
			width: 200px;
			background-color: white;
			left: 20%;
			top: 36%;
			position: relative;
			border-radius: 10px 10px;
			padding: 20px 20px;
		}

		.bottomB {
			width: 100%;
			display: flex;
			color: black;
			font-size: 20px;
			font-weight: bold;
			text-align: center;
			margin-top: 20px;

			view {
				width: 50%;
			}

			>view:last-child {
				color: #066EB5;
			}
		}

		.Fxtext {
			font-size: 20px;
			font-weight: bold;
		}

		.fxuser {
			width: 40px;
			height: 40px;
			margin: 20px 20px 20px 0;

			image {
				width: 100%;
				height: 100%;
			}
		}
	}

	.imgCount {
		position: absolute;
		bottom: 25%;
		right: 4%;
		text-align: center;
		color: white;
		z-index: 1;
		margin-bottom: 4px;

		img {
			width: 24px;
			height: 24px;
		}
	}

	.fxImg {
		bottom: 0%;

		img {
			width: 28px;
			height: 28px;
		}
	}

	.DEtailimg {
		width: 100%;
		height: 100vh;
		background: rgba(0, 0, 0, 0.4);
		position: fixed;
		top: 0;
		z-index: 111;

		>view {
			margin: 50% 0px 0px 0px;
		}

		image {
			width: 100%;
		}
	}

	.product {
		width: 100%;
		height: 100vh;
		background: rgba(0, 0, 0, 1);
		position: fixed;
		top: 0;
		z-index: 111;
	}

	.companyDetail {
		line-height: 1;
		background: #F1F1F1;

		.popup_con {
			padding: 30rpx;
			min-height: 600rpx;

			.xPopupTitle {
				font-weight: bold;
				font-size: 32rpx;
				text-align: center;
				padding: 30rpx 0 30rpx;
			}

			.pc_item {
				margin-bottom: 30rpx;
			}

			.pci_title {
				font-size: 28rpx;
				font-weight: bold;
			}

			.pci_desc {
				margin-top: 20rpx;
				display: flex;

				&>view {
					width: 25%;
					text-align: center;
				}

				&>view:first-child {
					width: 40%;
				}

				.item {
					margin: 0 10rpx;
					margin-top: 10rpx;
					height: 51rpx;
					line-height: 51rpx;
					background: #EFF8FF;
					border-radius: 26rpx 26rpx 26rpx 26rpx;
					font-size: 25rpx;
					color: #066EB5;
				}
			}
		}

		.companyImg {
			width: 100%;
			height: auto;
			position: relative;
			overflow: hidden;

			// background: black;
			.leftSliding {
				width: 200rpx;
				height: 90%;
				position: absolute;
				right: -140rpx;
				top: 50%;
				transform: translateY(-50%);
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				justify-content: center;
				background: rgba(255, 255, 255, 0.5);
				border-radius: 50%;
				padding-left: 10rpx;
				font-size: 26rpx;

				image {
					width: 60rpx;
					height: auto;
					display: block;
				}
			}
		}

		.processingTechnology {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			padding-top: 10rpx;

			.processingTechnology_list {
				display: flex;
				flex-wrap: wrap;
				flex: 1;
			}

			.arrow_right {
				width: 50rpx;
				margin-top: 20rpx;
			}

			.processingTechnology_item {
				margin-right: 20rpx;
				padding: 0 20rpx;
				margin-top: 10rpx;
				height: 51rpx;
				line-height: 51rpx;
				background: #EFF8FF;
				border-radius: 26rpx 26rpx 26rpx 26rpx;
				font-size: 25rpx;
				color: #066EB5;
			}
		}

		.detailedness {
			box-sizing: border-box;
			padding: 0 30rpx;
			background-color: #FFF;

			.detailednessBox {
				padding: 30rpx 0;
				border-bottom: 1rpx solid #F1F1F1;

				.detailednessTitle {
					display: flex;
					align-items: center;

					image {
						width: 30rpx;
						height: auto;
						margin-right: 15rpx;
					}

					view {
						font-size: 28rpx;
						color: #707070;
						font-weight: bold;
					}
				}
			}
		}

		.companyProduct {
			box-sizing: border-box;
			padding: 30rpx;
			background-color: #FFF;
			padding-bottom: 0;

			// margin-bottom: 10rpx;
			.companyProductTitle {
				font-size: 28rpx;
				color: #333333;
				font-weight: bold;
				margin-bottom: 30rpx;
			}

			.companyProductBox {
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;

				&>view {
					margin-bottom: 30rpx;
					border-radius: 8rpx;
					width: 337.5rpx;
					box-sizing: border-box;
					border: 2rpx solid rgba(0, 0, 0, 0.05);
					padding: 15rpx 15rpx 0rpx 15rpx;
					box-shadow: 0 0 10rpx 1rpx rgba(0, 0, 0, 0.4);

					image {
						border-radius: 8rpx;
						// width: 307.5rpx;
						width: 100%;
						height: 307.5rpx;
					}

					.text_con {
						padding: 15rpx;
						box-sizing: border-box;

						.text_con_title {
							font-size: 30rpx;
							text-align: center;
							white-space: nowrap;
							overflow: hidden;
							color: #000;
							text-overflow: ellipsis;
						}

						.text_desc {
							width: 100%;
							white-space: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
						}
					}

					view {
						font-size: 26rpx;
						color: #333333;
						line-height: 1.5;
					}
				}
			}
		}

		.companyComponents {
			display: flex;
			align-items: center;

			>view:first-child {
				width: 8rpx;
				height: 24rpx;
				background: #EC8425;
				border-radius: 4rpx 4rpx 4rpx 4rpx;
				margin-right: 15rpx;
			}

			>view:last-child {
				font-size: 28rpx;
				color: #333333;
				font-weight: bold;
			}
		}

		.companyIntro {
			box-sizing: border-box;
			padding: 30rpx;
			background-color: #FFF;
			margin-bottom: 10rpx;

			.companyCompanyIntroduction {
				margin-top: 20rpx;
				font-size: 28rpx;
				color: #707070;
				line-height: 1.5;
				margin-bottom: 40rpx;
			}

			.companyCompanyIntroduction .text-ellipsis {
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}

		.companyBox {
			box-sizing: border-box;
			padding: 30rpx;
			display: flex;
			align-items: center;
			// justify-content: space-between;
			background-color: #FFF;
			margin-bottom: 10rpx;

			// align-items: start;
			// position: relative;
			.bus_license {
				width: 100rpx;
				height: 100rpx;
				// position: absolute;
				// right: 0rpx;
				// text-align: center;
				justify-content: center;
				display: flex;
				align-items: center;

				// top: 0rpx;
				image {
					width: 80%;
					height: 80%;
				}
			}

			image {
				width: 120rpx;
				height: 120rpx;
				// margin-right: 10px;
				border-radius: 16rpx;
			}

			view {

				// width: 550rpx;
				.companyName {
					font-weight: bold;
					font-size: 31rpx;
					color: #000000;
				}

				.companyParticulars {
					font-size: 27rpx;
					color: #9C9C9C;
					line-height: 1.5;
					margin-top: 10rpx;
					display: flex;
					flex-wrap: wrap;
				}
			}
		}
	}
</style>